ISCModelProperty Interface

The following table contains information on the ISCModelProperty interface:

Signature

Description

Valid Arguments

void Value(VARIANT ValueId [optional], VARIANT ValueType [optional], VARIANT Val )

Sets the indicated property value with the given value

ValueId:

  • Empty � Not used when setting scalar properties.

ValueType:

  • Empty � Not used.

Val:

  • Dependent upon the property type.

For information about valid property values, see the HTML document erwin Metamodel Reference, in the Metamodel Reference Bookshelf located in the erwin� Data Modeler installation folder.

Example 21

The following example illustrates how to set scalar property values using C++. The example uses a Model Object object from Example 9 and assumes that a transaction has opened:

// 

ISCSession::BeginTransaction() must be called prior to calling this function

// ISCSession::CommitTransaction() must be called upon returning from this // function void SetNameProperty(ISCModelObjectPtr & scObjPtr, CString & csName) { ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties(); CString csPropName = "Name"; ISCModelPropertyPtr nameProp = propColPtr > GetItem(COleVariant(csPropName)); if (nameProp != NULL) nameProp->PutValue(vtMissing, (long) SCVT_BSTR, csName); }

The following example illustrates how to set scalar property values using Visual Basic .NET. The example uses a Model Object object from Example 9 and assumes that a transaction has opened:

' 

ISCSession::BeginTransaction() must be called prior to calling this function

' ISCSession::CommitTransaction() must be called upon returning from this function Public Sub SetScalarPropValue(ByRef scObj As SCAPI.ModelObject, ByRef val As Variant) Dim modelProp As SCAPI.ModelProperty modelProp = scObj.Properties(�Name�) modelProp.Value = val End Sub